#!/bin/bash
# --------------------------
# desc:
#     目录功能类
# author:
#     dockerlin@163.com
# --------------------------

#
# 检查该功能类依赖函数，所有依赖都检查
#
function dirtool_cxl(){
    #logger_debug "dirtool_cxl checking"
    local status=0
    return $status
}

#
# 自动加载指定目录下文件
# $1 传入目录
#
function cxlib_auto_load(){
    if [ -z "$1" ]; then return 1; fi
    if [ ! -d "$1" ]; then echo "not dir"; return 1; fi
    cur_dir="$1"
    tmpfilelist_=`ls ${cur_dir}`
    for file in $tmpfilelist_ ; do
        if [ "$file" = "index" ]; then continue; fi
        loadfile="${cur_dir}/$file"
        if [ -f $loadfile ]; then
            logger_debug "正在加载:$loadfile"
            source "$loadfile"
        fi
    done
    unset cur_dir tmpfilelist_
    return 0
}

